{% extends 'index.html' %}

{% block title %} {{ page_title }} {% endblock %}

{% block styles %}
    <link rel="stylesheet" type="text/css" href="/static/monitor.css" />
    <link rel="stylesheet" type="text/css" href="/static/scans.css" />
    <link rel="stylesheet" type="text/css" href="/static/css/south-street/jquery-ui-1.8.11.custom.css" />
    <link rel="stylesheet" type="text/css" href="/static/js/facebox/src/facebox.css" />
{% endblock %}

{% block scripts %}
{% endblock %}

{% block sidebar %}
{% endblock %}

{% block messages %}
    <div class="message-content">
        {% for message in messages %}
        <div class="{{ message.type }}">
            <img src="/static/images/spacer.gif" class="ui-icon-active ui-icon-{{ message.type }}" />
            <span>
            {{ message.body }}
            {% if message.url %}
                <a href="{{ message.url}}">{{ message.url_text }}</a>
            {% endif %}
            </span>
        </div>
        {% endfor %}
    </div>
{% endblock %}

{% block content %}
    <div class="container">
    <table class="r6">
        <tr class="headline">
            <th>Title</th>
            <th>Provider</th>
            <th>Started</th>
            <th>Finished</th>
            <th>Checked links</th>
            <th>Results</th>
            <th>Action</th>
        </tr>
        {% if scans|length %}
        {% for item in scans %}
        <tr class="scans {% cycle 'odd' 'even' %} row">
            <td rel="{{ item.scan.title }}">
                <a href="/view/scan/{{ item.scan.id }}" title="View results">{{ item.scan.title }}</a>
            </td>
            <td rel="{{ item.provider }}">
                {{ item.provider }}
            </td>
            <td rel="{{ item.scan.start_date }}">
                {{ item.scan.start_date }}
            </td>
            <td rel="{{ item.scan.end_date }}">
                {{ item.scan.end_date }}
            </td>
            <td rel="{{ item.scan.num_links }}">
                {{ item.scan.num_links }}
            </td>
            <td rel="{{ item.results|length }}">
                {{ item.results|length }}
            </td>
            <td class="link-actions">
                <a href="/archive/{{ item.scan.id }}">
                    <img src="/static/images/spacer.gif" class="link-tools ui-icon ui-icon-suitcase" title="Archive results">
                </a>
                <a href="/remove/proxy/{{ item.scan.id }}">
                    <img src="/static/images/spacer.gif" class="link-tools ui-icon ui-icon-trash" title="Remove scan">
                </a>
            </td>
        </tr>
        {% endfor %}
        {% else %}
            <tr class="{% cycle 'odd' 'even' %} row">
                <td colspan="7" class="align-center pad5">
                <span>There're no works done yet</span>
            </td>
            </tr>
        {% endif %}
    </table>
    </div>
{% endblock %}
